package com.gnerv.pabu.plugin.config;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.util.xmlb.XmlSerializerUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Slf4j
@Data
@State(name = "PabuSettings", storages = @Storage("pabu-settings.xml"))
public class PabuSettings implements PersistentStateComponent<PabuSettings> {

    public PabuSettings() {
    }

    @Nullable
    @Override
    public PabuSettings getState() {
        return this;
    }

    @Override
    public void loadState(@NotNull PabuSettings pabuSettings) {
        XmlSerializerUtil.copyBean(pabuSettings, this);
    }
}